﻿@model HMoPro.Models.UploadResourceFile

@{
    ViewBag.Title = "EditResourceSecondPart";
}
@{
    //Layout = null;
}
<style>
    #up {
        margin-top:-5px;
    }
    #up span {
        display:inline-block;
        padding-right:5px;
    }
    #up span .uploadify {
        top: 0;
    }
    fieldset .col-xs-1, fieldset .col-xs-11 {
        margin-bottom: 10px;
    }
</style>
<div id="main">
    <h3>编辑资源 - STEP 2</h3>

    <link href="@Url.Content("~/Scripts/uploadify-v3.1/uploadify.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/uploadify-v3.1/jquery.uploadify-3.1.min.js")" type="text/javascript"></script>

    @*@Styles.Render("~/uploadify-v3.1/css")
        @section Scripts {
            @Scripts.Render("~/bundles/jquery-1.7.1")
            @Scripts.Render("~/bundles/uploadify")
        }*@


    @using (Html.BeginForm())
    {
        @Html.ValidationSummary(true)

        <fieldset class="row" style="padding-top:20px;">
            <div class="col-xs-1">
                @Html.LabelFor(model => model.Uploadimage)
            </div>
            @*<div class="col-xs-11">
                @Html.ValidationMessageFor(model => model.Uploadimage)
            </div>*@
            <div class="col-xs-11" id="up">
                @*                @Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
            @Html.ActionLink("Details", "Details", new { id=item.Id }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.Id })*@
                <script type="text/javascript">
                    var auth = "@(Request.Cookies[FormsAuthentication.FormsCookieName]==null ? string.Empty : Request.Cookies[FormsAuthentication.FormsCookieName].Value)";
                    var ASPSESSID = "@Session.SessionID";

                    $(function () {
                        $('#image1').uploadify({
                            'auto': false,
                            'formData': { 'resourceid': '@ViewData["resourceid"]', 'state': 2, 'ASPSESSID': ASPSESSID, 'AUTHID': auth },
                            'buttonText': '请选择图片',
                            'swf': '@Url.Content("~/Scripts/uploadify-v3.1/uploadify.swf")',
                            'uploader': '/Resource/addimage',
                            @* 'buttonImage': '@Url.Content("~/Scripts/uploadify-v3.1/browse-btn.png")',*@
                            'fileTypeDesc': '图片文件',
                            'method': 'post',
                            'fileTypeExts': '*.gif; *.jpg; *.png;*.gif;*.bmp',
                            'onUploadComplete': function (file) {
                                $('#showimage').html('图片 ' + file.name + ' 成功上传！');
                            }
                            //'onQueueComplete': function (queueData) {
                            //    $('#showimage').html(queueData.uploadsSuccessful + '个图片已经成功上传！.');
                            //}
                        });
                    });
                </script>
                <span>上传图片： </span><span><input type="file" id=image1 name="image_upload" style="display:inline-block;" /></span>
                <span><a href="javascript:$('#image1').uploadify('upload','*');">上传</a>
                    <a href="javascript:$('#image1').uploadify('cancel', '*');">取消</a></span>
                @*<div>
                <a href="javascript:$('#image_upload').uploadify('upload');">上传</a>
            </div>*@
                <div id="showimage"></div>
            </div>

            @if (User.IsInRole("Admin"))
            {
                <div class="col-xs-1">
                    @Html.LabelFor(model => model.checkornot)
                </div>

                <div class="col-xs-11">

                    @Html.RadioButtonFor(model => model.checkornot, 1, new { name = "radiobtn" }) 通过&emsp;
                    @Html.RadioButtonFor(model => model.checkornot, 2, new { name = "radiobtn" }) 不通过
                    @Html.ValidationMessageFor(model => model.checkornot)
                </div>
            }
            <div class="col-xs-11 col-xs-offset-1">
                @Html.Hidden("resourceid", ViewData["resourceid"])
                @Html.ActionLink("上一步", "EditResourceFirstPart", new { resourceid = ViewData["resourceid"] }) <span>&emsp; | &emsp;</span><input type="submit" value="保存" class="button button-raised button-caution button-pill button-normal" />
            </div>
        </fieldset>
    }
    <div style="display:none;">
        @Html.ActionLink("Back to List", "Index")
    </div>

    @*@section Scripts {
            @Scripts.Render("~/bundles/jqueryval")
        }*@
</div>

<script>
    $("#carousel-hm").css("display", "none");
    $("#f2 a").html("<font> " + $("#f2 a").text() + " </font>")
    $("#f2 a").addClass("selected");
</script>